﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using BUS;

namespace TuyenDungViecLam.Admin
{
    public partial class CapNhatPhiNguoiTimViec : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                LienKetDuLieu();

            }
        }

        private void LienKetDuLieu()
        {
            GrvNguoiTimViecPhi.DataSource = NguoiTimViec_BUS.LayThongTinPhiVaNguoiTimViec();
            GrvNguoiTimViecPhi.DataBind();
        }

        protected void GrvNguoiTimViecPhi_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Label lbTinhTrang = (Label)e.Row.FindControl("LbTinhTrang");
                Label lbHienThiTinhTrang = (Label)e.Row.FindControl("LbHienThiTinhTrang");

                if (lbTinhTrang.Text == "0")
                    lbHienThiTinhTrang.Text = "hết hiệu lực";
                else
                    if (lbTinhTrang.Text == "1")
                        lbHienThiTinhTrang.Text = "còn hiệu lực";
            }
        }

        protected void GrvNguoiTimViecPhi_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            GrvNguoiTimViecPhi.PageIndex = e.NewPageIndex;
            LienKetDuLieu();
        }

        protected void BtTimKiem_Click(object sender, EventArgs e)
        {
            GrvNguoiTimViecPhi.DataSource = NguoiTimViec_BUS.TimKiemPhiVaNguoiTimViec(TbHoTenEmail.Text);
            GrvNguoiTimViecPhi.DataBind();
        }

        protected void GrvNguoiTimViecPhi_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Edit")
            {
                int maNguoiTimViec = int.Parse(e.CommandArgument.ToString());

                Response.Redirect("EditPhiNguoiTimViec.aspx?mntv=" + maNguoiTimViec.ToString());

            }
        }

    }
}
